#define FUNTOOL_H

#include <QThread>
#include <QWaitCondition>
class masterthread : public QThread  
{  
    Q_OBJECT  
  
public:  
    masterthread(QObject *parent = 0);  
    ~masterthread();  
  
    void transaction(const QString &portName, int waitTimeout, const QString &request);  
    void run();  
  
signals:  
    void response(const QString &s);  
    void error(const QString &s);  
    void timeout(const QString &s);  
  
private:  
    QString portName;  
    QString request;  
    int waitTimeout;  
    QMutex mutex;  
    QWaitCondition cond;  
    bool quit;  
};